<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function arr(s) {
      const dict = new Set();
      let ans = '';

      for (const c of s) {
        dict.add(c);
        const l = c.toLowerCase(), L = c.toUpperCase();
        if (L > ans && dict.has(l) && dict.has(L)) ans = L;
      }
      return ans;
    };
    console.log(arr(s = "lEeTcOdE"));
  </script>
</body>

</html>